/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
 package com.wealth.coupon.entity;


import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.wealth.member.entity.Member;


/**
 * 优惠券记录表
 * @author chan
 */
@Entity
@Table(name = "t_coupon_record")
public class CouponRecord implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private Long id;
	private Member member;			//会员
	private CouponRule rule;				//规则
	private Integer status;					//未使用=0 使用=1
	private String code;						//优惠券序列号
	private Date createTime;				//使用时间
	private Integer mode;			//优惠券批次模式 1纸质 2完善地址 3电子优惠券
	
	/* ---------------- method ----------------*/
	
	public CouponRecord(){
	}

	public CouponRecord(Long id){
		this.id = id;
	}

	/* ---------------- getter/setter ----------------*/
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Column(name = "code")
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	@ManyToOne
	@JoinColumn(name="rule_id")
	public CouponRule getRule() {
		return rule;
	}

	public void setRule(CouponRule rule) {
		this.rule = rule;
	}

	@ManyToOne
	@JoinColumn(name="member_id")
	public Member getMember() {
		return member;
	}
	
	public void setMember(Member member) {
		this.member = member;
	}

	public Integer getMode() {
		return mode;
	}

	public void setMode(Integer mode) {
		this.mode = mode;
	}
	
	
	
}



